package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.Map;
import com.itheima.service.MapService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author : sunjun
 * @email : sunjun0207@163.com
 * @create 2019/11/22 13:53
 */
//移动端-->地址查询
@RestController
@RequestMapping("/map")
public class MapController {
    //注入mapService
    @Reference
    private MapService mapService;


    //地址查询
    @RequestMapping("/findAllAddress")
    public Result findAllAddress(){
        //程序安全性和健壮性处理
        try {
            //调用mapService完成查询
            List<Map> address =  mapService.findAllAddress();
            return new Result(true, MessageConstant.QUERY_ADDRESS_SUCCESS,address);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,MessageConstant.QUERY_ADDRESS_FAIL);
        }


    }


}
